<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- JSTL -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>员工成绩列表</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<script src="js/jquery-2.0.3.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="./css/x-admin.css" media="all">
<script src="layui/layui.js" charset="utf-8"></script>
</head>
<body>
	<div class="x-nav">
		<span class="layui-breadcrumb"> <a><cite>首页</cite></a> <a><cite>员工管理</cite></a>
			<a><cite>员工成绩列表</cite></a>
		</span> <a class="layui-btn layui-btn-small"
			style="line-height: 1.6em; margin-top: 3px; float: right"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="layui-icon" style="line-height: 30px">ဂ</i></a>
	</div>
	<div class="x-body">
		<xblock>
		<button class="layui-btn"
			onclick="member_add('添加课程列表','EmpScoreAdd.jsp','800','550')">
			<i class="layui-icon">&#xe608;</i>添加
		</button>
		<form action="EmpScoreServlet" method="post" style="display: inline-block">
           	<div class="layui-input-inline">
	           	<select class="layui-select" name="selectKey" id="selectKey"></select>
			</div>
			<div class="layui-input-inline">
				<input type="hidden" id="select" value="<%=request.getAttribute("selectKey")%>">
				<input type="text" name="empNoQuery" placeholder="请输入要查询的信息"
					id="empNoQuery" autocomplete="off" class="layui-input"
					value="${empNoQuery}" style="width:300px">
			</div>
			<div class="layui-input-inline" style="width: 50px">
				<button class="layui-btn" type="submit" lay-submit="" lay-filter="sreach">
					<i class="layui-icon">&#xe615;</i>
				</button>
			</div>
		</form>

		<span class="x-right" style="line-height: 40px">共有数据：<span
			class="layui-badge">${pd.totalCount}</span> 条
		</span>
		</xblock>
		<table class="layui-table">
			<thead>
				<tr>
					<th>成绩编号</th>
					<th>员工号</th>
					<th>员工名</th>
					<th>课程计划号</th>
					<th>课程名</th>
					<th>教员号</th>
					<th>教员名</th>
					<th>成绩</th>
					<th width="300px">教员评语</th>
					<th>是否通过</th>
					<th>操作</th>
				</tr>
			</thead>
			<c:if test="${pd==null}">
				<c:redirect url="EmpScoreServlet"></c:redirect>
			</c:if>
			<!-- 判断是否为空 -->
			<c:if test="${pd!=null}">
				<!-- 遍历 -->
				<c:forEach items="${pd.data}" var="EmpScore">
					<tbody id="x-img">
						<tr>
							<td>${EmpScore.scoreNo}</td>
							<td>${EmpScore.empNo}</td>
							<td>${EmpScore.empName}</td>
							<td>${EmpScore.cpNo}</td>
							<td>${EmpScore.courseName}</td>
							<td>${EmpScore.teacherNo}</td>
							<td>${EmpScore.teacherName}</td>
							<td>${EmpScore.score}</td>
							<td>${EmpScore.notes}</td>
							<td class="td-status">
								<c:if test="${EmpScore.pass==1}">
									<span class="layui-btn layui-btn-normal ">已通过</span>
								</c:if> <c:if test="${EmpScore.pass==0}">
									<span class="layui-btn layui-btn-danger ">未通过 </span>
								</c:if></td>
							<td>
								<a title="编辑" href="javascript:;"
								onclick="member_edit('编辑','EmpScoreUpd.jsp?scoreNo=${EmpScore.scoreNo}&empNo=${EmpScore.empNo}&cpNo=${EmpScore.cpNo}&teacherNo=${EmpScore.teacherNo}&score=${EmpScore.score}&notes=${EmpScore.notes}&pass=${EmpScore.pass}'
								,'4','','510')"
								class="ml-5" style="text-decoration: none"> <i class="layui-icon">&#xe642;</i>
								</a>
							</td>
						</tr>
					</tbody>
				</c:forEach>
			</c:if>
		</table>

		<div id="page" style="text-align: center"></div>
	</div>
	<script src="./js/x-layui.js" charset="utf-8"></script>
	<script>
	layui.use(['laypage', 'layer'], function(){
		  var laypage = layui.laypage,
		  layer = layui.layer;
		  
		laypage.render({
			elem : 'page',
			theme:'#00BFFF',
			count : ${pd.totalCount},//数据总数，从服务端得到
			curr:${pd.page},//得到当前页，以便向服务端请求对应页的数据。
			limit:${pd.pageSize},//得到每页显示的条数
			layout : [ 'prev', 'page', 'next',  ],
			jump : function(obj,first) {
				var empNoQuery = $("#empNoQuery").val();
				 //obj包含了当前分页的所有参数，
				//首次不执行
			    if(!first){
			    	location.href = "EmpScoreServlet?op=queryByPage&page="
						+ obj.curr+"&pageSize="+obj.limit+"&empNoQuery="+empNoQuery;
			    }
			}
		});
	});

		//批量删除提交
		function delAll() {
			layer.confirm('确认要删除吗？', {
				icon : 3,
				title : '提示信息'
			}, function(index) {
				//捉到所有被选中的，发异步进行删除
				layer.msg('删除成功', {
					icon : 1
				});
			});
		}
		/*用户-添加*/
		function member_add(title, url, w, h) {
			x_admin_show(title, url, w, h);
		}
		/*用户-查看*/
		function member_show(title, url, id, w, h) {
			x_admin_show(title, url, w, h);
		}
		// 用户-编辑
		function member_edit(title, url, id, w, h) {
			x_admin_show(title, url, w, h);
			
		}
		/*用户-删除*/
		function member_del(obj, id) {
			layer.confirm('确认要删除吗？', {
				icon : 3,
				title : '提示信息'
			}, function(index) {
				//发异步删除数据
				$(obj).parents("tr").remove();
				layer.msg('已删除!', {
					icon : 1,
					time : 1000
				});
			});
		}
		/* 查询选择  */
		var selectKey = ['员工号','员工名','课程名','教员名'];
		var Key = $("#select").val();
		$(function(){
			$("#selectKey").append("<option value = "+Key+">"+Key+"</option>");
			$.each(selectKey,function(i,o){
				if( o!=Key ){
					$("#selectKey").append("<option value = "+o+">"+o+"</option>");
				}
			})
		})
	</script>
</body>
</html>